package cn.iocoder.yudao.module.ao.dal.mysql.curriculum;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.curriculum.CurriculumDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.curriculum.vo.*;

/**
 * 课程体系 Mapper
 *
 * @author 禾安
 */
@Mapper
public interface CurriculumMapper extends BaseMapperX<CurriculumDO> {

    default PageResult<CurriculumDO> selectPage(CurriculumPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CurriculumDO>()
                .eqIfPresent(CurriculumDO::getMajorId, reqVO.getMajorId())
                .likeIfPresent(CurriculumDO::getCurriculumName, reqVO.getCurriculumName())
                .eqIfPresent(CurriculumDO::getCurriculumCode, reqVO.getCurriculumCode())
                .eqIfPresent(CurriculumDO::getVersion, reqVO.getVersion())
                .eqIfPresent(CurriculumDO::getEffectiveYear, reqVO.getEffectiveYear())
                .eqIfPresent(CurriculumDO::getTotalCredits, reqVO.getTotalCredits())
                .eqIfPresent(CurriculumDO::getRequiredCredits, reqVO.getRequiredCredits())
                .eqIfPresent(CurriculumDO::getElectiveCredits, reqVO.getElectiveCredits())
                .eqIfPresent(CurriculumDO::getPracticalCredits, reqVO.getPracticalCredits())
                .eqIfPresent(CurriculumDO::getDescription, reqVO.getDescription())
                .eqIfPresent(CurriculumDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(CurriculumDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CurriculumDO::getCurriculumId));
    }

}